from django.db import models


#  用户表
class User(models.Model):
    name = models.CharField('用户名',max_length=32)
    number = models.CharField('账号',max_length=11)
    password = models.CharField('密码',max_length=20)
    img = models.CharField('头像',max_length=256)
    qian = models.CharField('签名',max_length=128)
    class Meta:
        db_table = 'tb_user'
        verbose_name_plural = '用户表'
    def __str__(self):
        return self.name


#  好友表
class Friend(models.Model):
    user_id = models.IntegerField('用户ID')
    friend_id = models.IntegerField('好友ID')
    shield = models.IntegerField('是否屏蔽好友(0:屏蔽,1:未屏蔽)',default=1)
    class Meta:
        db_table = 'tb_friend'
        verbose_name_plural = '好友表'
    def __str__(self):
        return self.user_id


#  朋友圈表
class Friend_circle(models.Model):
    user_id = models.ForeignKey(to=User,on_delete=models.CASCADE,verbose_name='用户ID')
    text = models.CharField('内容',max_length=50)
    release_time = models.DateTimeField('发布时间',auto_now_add=True)
    class Meta:
        db_table = 'tb_friend_circle'
        verbose_name_plural = '朋友圈表'
    def __str__(self):
        return self.user_id


#  朋友圈照片，视频
class Friend_img(models.Model):
    img = models.CharField('朋友圈照片',max_length=20480)
    video = models.CharField('朋友圈视频',max_length=1024)
    fr_cir = models.ForeignKey(to=Friend_circle,on_delete=models.CASCADE,verbose_name='所属朋友圈')
    class Meta:
        db_table = 'tb_friend_img'
        verbose_name_plural = '朋友圈图片表'
    def __str__(self):
        return self.fr_cir.user_id




